package cn.sfa.service.system;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat; 
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap; 
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired; 
import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.sfa.common.pagination.Pagination;
import cn.sfa.common.utils.CommonUtil;
import cn.sfa.common.utils.DateUtil;
import cn.sfa.entity.routine.SalePrivateAffair; 
import cn.sfa.entity.system.SaleSysCode;
/**
 * 
* 类名称：
* 类描述： SysCode服务类
* 创建人：lenovo   
* 创建时间：2012-2-20 上午11:32:36   
* 修改人：lenovo   
* 修改时间：2012-2-20 上午11:32:36   
* 修改备注：   
* @version
 */
@Service
@Transactional
public class SaleSysCodeService {
	
	@Autowired
	NamedParameterJdbcTemplate jdbcTemplate;
 
	/*
	 * 根据ID获取SysCode
	 */
	public SaleSysCode getSaleSysCode(String saleSysCodeID){
		String sqlStr = 
				"select * from salesyscode " +
				" where salerecordid = :salerecordid";
		Map<String, Object> paramMap = new HashMap<String, Object>(); 
		paramMap.put("salerecordid", saleSysCodeID);
		
		final SaleSysCode saleSysCode = new SaleSysCode();
		jdbcTemplate.query(sqlStr, paramMap, new RowCallbackHandler() {

			public void processRow(ResultSet rs) throws SQLException { 
				saleSysCode.setSaleRecordId(rs.getString("saleRecordId"));
				saleSysCode.setChnName(rs.getString("chnName"));
				saleSysCode.setCodeClass(rs.getString("codeClass"));
				saleSysCode.setViewSeq(rs.getString("viewSeq"));  
			}
		}); 
		return saleSysCode;
	} 

}
